load("//tools:defaults.bzl", "karma_web_test_suite", "markdown_to_html", "ng_module", "ts_library")

package(default_visibility = ["//visibility:public"])

# We need to use "ng_module" here since we want metadata to be generated for keycode
# constants. This is necessary because some of these constants are statically used in
# component/directive metadata (e.g. chips) and NGC needs to be able to evaluate these
# at compile time.
ng_module(
    name = "keycodes",
    srcs = glob(
        ["**/*.ts"],
        exclude = ["**/*.spec.ts"],
    ),
)

ts_library(
    name = "unit_test_sources",
    testonly = True,
    srcs = glob(
        ["**/*.spec.ts"],
        exclude = ["**/*.e2e.spec.ts"],
    ),
    deps = [
        ":keycodes",
        "//src/cdk/testing/private",
        "@npm//@types/jasmine",
    ],
)

karma_web_test_suite(
    name = "unit_tests",
    deps = [":unit_test_sources"],
)

markdown_to_html(
    name = "overview",
    srcs = [":keycodes.md"],
)

filegroup(
    name = "source-files",
    srcs = glob(["**/*.ts"]),
)
